package com.jinmdz.fmis.api.api.controller;

import com.jinmdz.fmis.api.api.model.transport.TransportCarCodeData;
import com.jinmdz.fmis.api.api.service.TransportCarService;
import com.jinmdz.fmis.api.base.BaseController;
import com.jinmdz.fmis.core.base.BaseResult;
import com.jinmdz.fmis.dao.model.transport.TransportCarItem;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.ArrayList;

/**
 * 车辆相关接口
 *
 * @author LiCongLu
 * @date 2020-01-20 10:28
 */
@Api(description = "车辆相关接口")
@RestController()
@RequestMapping("/api/transport-car")
public class TransportCarController extends BaseController {

    @Resource
    private TransportCarService transportCarService;

    /**
     * 根据车辆类型加载transport_car表中车辆信息
     *
     * @param
     * @return
     * @author LiCongLu
     * @date 2020-01-20 10:30
     */
    @ApiOperation(value = "根据车辆类型加载transport_car表中车辆信息", notes = "根据字典中车辆类型【transport_car_type】加载transport_car表中车辆信息.")
    @PostMapping("/load-transport-car-with-type-code")
    public BaseResult<ArrayList<TransportCarItem>> loadTransportCarWithTypeCode(@RequestBody TransportCarCodeData data) {
        return resultHandler(data, userItem -> transportCarService.loadTransportCarWithTypeCode(data));
    }
}
